package aufgabe2;

import java.io.Serializable;
import java.util.*;

/**
 * definition of a Course-object
 * 
 * @author Lukas Koell
 * @author David Medenjak
 * @author Johannes Riedmann
 */
public class Course extends SubscribeableImpl{
  public Course(int courseNr, String title, GregorianCalendar subscribeStart,
          GregorianCalendar subscribeEnd, GregorianCalendar unsubscribeEnd,
          ArrayList<Course> requirements, int maxSeats) {
      super(courseNr, title, subscribeStart, subscribeEnd, unsubscribeEnd, requirements, maxSeats);
  }

  /**
   * getter for the unique course Nr
   * @return the courseNr
   */
  public int getCourseNr() {
    return this.getId();
  }

  /**
   * @param courseNr the courseNr to set
   */
  public void setCourseNr(int courseNr) throws AccessDeniedException {
    checkUserCanEditCourse();
    setId(courseNr);
    notifyStudents(new StudentNotification("Course "+getTitle()+" changed the number to "+courseNr));
  }
}
